package com.jsgt.greekfire.ui.mine.user.activation.adapter

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import com.fhx.core.base.BaseAdapter
import com.fhx.core.base.BaseViewHolder
import com.jsgt.greekfire.R
import com.jsgt.greekfire.bean.TransferBean

/**
 * 激活列表适配器
 * author fhx
 * create time 2020/4/26 19:05
 **/
class ActivationAdapter : BaseAdapter<TransferBean>() {

    inner class VH(itemView: View) : BaseViewHolder(itemView) {
        var id_tv: TextView? = null
        var confirm_tv: TextView? = null

        init {
            id_tv = itemView.findViewById(R.id.id_tv)
            confirm_tv = itemView.findViewById(R.id.confirm_tv)
        }

        fun bindData(bean: TransferBean) {
            id_tv?.text = "ID:${bean.fromUserName}给你转了${bean.amount}GLB"
            confirm_tv?.setOnClickListener {
                viewClickListener?.invoke(bean)
            }
        }
    }

    override fun provideViewHolder(parent: ViewGroup, viewType: Int): BaseViewHolder? {
        val view =
            LayoutInflater.from(parent.context).inflate(R.layout.item_activation, parent, false)
        return VH(view)
    }
    override fun onBindViewHolder(holder: BaseViewHolder, position: Int) {
        val viewHolder = holder as VH
        viewHolder.bindData(dataList()[position])
    }
}